package com.yaoli.fanXing;

import java.lang.reflect.Array;
import java.util.ArrayList;

/**
 * Created by will on 2017/6/4.
 */
public class Object {

    public static void main(String[] args) {
        ArrayList<Apple> list = new ArrayList<>();
        list.add(new Apple());
        list.add(new Apple());
        list.add(new Apple());
        list.add(new Apple());

        ArrayList<? extends Fruit> list1 = new ArrayList<>();

        ArrayList<? super Fruit> list2 = new ArrayList<>();
        list2.add(new Fruit());
        list2.add(new Apple());
        list2.add(new RedApple());


        ArrayList<Fruit> list3 = new ArrayList<>();
        list3.add(new Apple());
        list3.add(new Fruit());
        list3.add(new RedApple());

        Apple apple = (Apple) list3.get(0);
        list3.get(1);
        list3.get(2);





        System.out.println("");
    }

}
//Lev 1
class Food{}

//Lev 2
class Fruit extends Food{}
class Meat extends Food{}

//Lev 3
class Apple extends Fruit{}
class Banana extends Fruit{}



class Pork extends Meat{}
class Beef extends Meat{}

//Lev 4
class RedApple extends Apple{}
class GreenApple extends Apple{}